﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HttpDownloader
{
    public partial class Setting : Form
    {
        public string m_pStrProxy = "";
        public string m_pStrPort = "";
        public int m_iNumberConnects = 2;

        public Setting()
        {
            InitializeComponent();
            m_pGrbHttp.Enabled = false;
            m_pGrbHttps.Enabled = false;
        }

        private void m_pCkUseHTTPProxy_CheckedChanged(object sender, EventArgs e)
        {
            if (m_pCkUseHTTPProxy.Checked)
            {
                m_pGrbHttp.Enabled = true;
            } 
            else
            {
                m_pGrbHttp.Enabled = false;
            }           
        }

        private void m_pCkUseHTTPSProxy_CheckedChanged(object sender, EventArgs e)
        {         
            if (m_pCkUseHTTPSProxy.Checked)
            {
                m_pGrbHttps.Enabled = true;
            }
            else
            {
                m_pGrbHttps.Enabled = false;
            }
        }

        private void m_pBtnOK_Click(object sender, EventArgs e)
        {
            if (m_pCkUseHTTPSProxy.Checked)
            {
                m_pStrProxy = m_pTxtProxyHttps.Text;
                m_pStrPort = m_pTxtPortHttps.Text;
            }
            else if (m_pCkUseHTTPProxy.Checked)
            {
                m_pStrProxy = m_pTxtProxyHttp.Text;
                m_pStrPort = m_pTxtPortHttp.Text;
            }
            else
            {
                m_pStrProxy = "";
                m_pStrPort = "";
            }
            this.Close();
        }

        private void m_pNumricConnections_ValueChanged(object sender, EventArgs e)
        {
            string _strNumberConnects = m_pNumricConnections.Value.ToString();
            m_iNumberConnects = Convert.ToInt16(_strNumberConnects);
        }
    }
}
